package com.yuanfeng.userms.controller;

import com.yuanfeng.commoms.util.ResponseResult;
import com.yuanfeng.userms.dto.ManageBatchDeleteImageDTO;
import com.yuanfeng.userms.dto.ManageImageNameUpdateParamDTO;
import com.yuanfeng.userms.dto.ManageImageSpaceQueryDTO;
import com.yuanfeng.userms.dto.ManageImageUploadParamDTO;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @ClassName UserUploadBaseController
 * @Description 用户附件表-图片、视频
 * @Author cf
 * @Date 2023/6/29 9:09
 * @Version 1.0
 */
@RestController
@RequestMapping("/user/upload/base")
public class UserUploadBaseController extends BaseController{

    /**
     * 图片空间查询
     *
     * @param param
     * @return
     */
    @PostMapping("/image/space/query")
    public ResponseResult queryImageSpace(@RequestBody ManageImageSpaceQueryDTO param) throws IllegalAccessException {
        ResponseResult result =userUploadBaseService.queryImageSpace(param);
        return result;
    }


    /**
     * 删除图片
     * @param param
     * @return
     */
    @PostMapping("/image/delete")
    public ResponseResult deleteImage(@RequestBody ManageBatchDeleteImageDTO param) {
        ResponseResult result =userUploadBaseService.deleteImage(param);
        return result;
    }

    /**
     * 更改图片名称
     * @param param
     * @return
     */
    @PostMapping("/image/name/update")
    public ResponseResult updateImageName(@RequestBody ManageImageNameUpdateParamDTO param) {
        ResponseResult result =userUploadBaseService.updateImageName(param);;
        return result;
    }


    /**
     * 上传图片
     * @param param
     * @return
     */
    @PostMapping("/image/upload")
    public ResponseResult unloadImage(@RequestBody ManageImageUploadParamDTO param) {
        ResponseResult result =userUploadBaseService.uploadImage(param);
        return result;
    }


}
